//
//  YTFBasicTableViewController.m
//  weibo_yoo_OC
//
//  Created by pro on 16/2/27.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "YTFBasicTableViewController.h"
#import "YTFVisitor.h"
#import "YTFLoginViewController.h"
#import "YTFBasicNavController.h"

//遵循代理协议
@interface YTFBasicTableViewController ()<YTFVisitorDelegate>

@end

@implementation YTFBasicTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //添加访客视图
    self.visitor = [[YTFVisitor alloc]initWithFrame:self.view.bounds];
    
    //设置代理
    self.visitor.delegate = self;
    
    //设置访客视图为根视图
    self.view = self.visitor;
    
    [self setupUI];
}


-(void)setupUI{
    
    UIBarButtonItem *leftBtn = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(registerClick)];
    
    UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(loginClick)];
    
    self.navigationItem.leftBarButtonItem = leftBtn;
    self.navigationItem.rightBarButtonItem = rightBtn;
}

#pragma mark -visistor的代理协议
//注册按钮点击事件
-(void)registerClick{
//    NSLog(@"注册");
    YTFLoginViewController *loginVC = [[YTFLoginViewController alloc]init];
    
    //实例化一个导航控制器
//    UINavigationController *navVC = [[UINavigationController alloc]initWithRootViewController:loginVC];
    YTFBasicNavController *navVC = [[YTFBasicNavController alloc]initWithRootViewController:loginVC];
    
    
    //调转到这个控制器
    [self presentViewController:navVC animated:YES completion:nil];
    
}

//登录按钮点击事件
-(void)loginClick{
    NSLog(@"登录");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
    return 0;
}




@end
